The invention relates generally to a web server framework, and more particularly to managing the state of server-side control objects that process client-side user interface elements of a web page.
A typical web browser receives data from a web server that defines the appearance and rudimentary behavior of a web page for display on a client system. In a typical scenario, a user specifies a Uniform Resource Locator (xe2x80x9cURLxe2x80x9d), which is a global address of a resource on the World Wide Web, to access a desired web site. Generally, the term xe2x80x9cresourcexe2x80x9d refers to data or routines that can be accessed by a program. An example URL is xe2x80x9chttp://www.microsoft.com/ms.htmxe2x80x9d. The first part of the example URL indicates a given protocol (i.e., xe2x80x9chttpxe2x80x9d) to be used in the communication. The second part specifies the domain name (i.e., xe2x80x9cwwww.microsoft.comxe2x80x9d) where the resource is located. The third part specifies the resource (i.e., a file called xe2x80x9cms.htmxe2x80x9d) within the domain. Accordingly, a browser generates an HTTP (HyperText Transport Protocol) request associated with the example URL to retrieve the data associated with ms.htm file within the www.microsoft.com domain. A web server hosting the www.microsoft.com site receives the HTTP request and returns the requested web page or resource in an HTTP response to the client system for display in the browser.
The xe2x80x9cms.htmxe2x80x9d file of the example above includes static HTML (HyperText Markup Language) code. HTML is a plain-text authoring language used to create documents (e.g., web pages) on the World Wide Web. As such, an HTML file can be retrieved from a web server and displayed as a web page in a browser. Using HTML, a developer can, for example, specify formatted text, lists, forms, tables, hypertext links, inline images and sounds, and background graphics for display in the browser to present the rich graphical experience that users have come to expect while viewing information from the Internet. An HTML file, however, is a static file that does not inherently support dynamic generation of web page content.
If dynamic content is to be displayed, such as a change stock price or traffic information, a server-side application program is generally developed to handle the more complex client-server interaction. The server-side application program processes an HTTP request and generates the appropriate HTML code for transmission to the client in an HTTP response. An exemplary HTTP request may include parameters, such as data in a query string or data from web-based forms. As such, a server-side application program can process the parameters and dynamically generate HTML code in an HTTP response to the client. An exemplary server-side application program may dynamically generate documents containing appropriate HTML code using a sequence of one or more formatted text write operations to a memory structure. Thereafter, the resulting document is transmitted to a client system in an HTTP response, where it is displayed as a web page in the browser.
Developing a server-side application program can be a complex task requiring not only familiarity with normal HTML coding that is used to layout a web page, but also with programming basics, including one or more programming languages, (e.g., C++, Perl , Visual Basic, or Jscript). Web page designers, on the other hand, are frequently graphics designers and editors, who may lack programming experience. Furthermore, simplifying complex web page development can speed the development of new web content by any developer. Generally, development of a custom server-side application program also requires tremendous effort, so much, in fact, that developers are often disinclined to attempt it. It is desirable, therefore, to provide a development framework that allows a developer to dynamically create and process a web page with minimal programming.
One approach to minimize the programming requirements of dynamic web page generation has been the Active Page (ASP) framework, provided by Microsoft Corporation. An ASP resource typically includes Visual Basic or Jscript code, for example, to process an HTTP request that specifies the ASP resource as the desired resource and, thereafter, to generate the resulting HTML code in a HTTP response to the client. Furthermore, an ASP resource may reference pre-developed or third party client-side library components (e.g., client-side xe2x80x9cACTIVEXxe2x80x9d controls) instead of requiring that the page developer write all components from scratch. However, in the current server-side application frameworks, the programming required to dynamically manage client-side user interface elements (e.g., text boxes, list boxes, buttons, hypertext links, images, sounds, etc.) within server-side applications can still require sophisticated programming skills and considerable effort. An unanswered problem exists in property encapsulating programming required to process user interface elements, so as to allow the web page developer to focus on other aspects of the web page.
Server-side processing of client-side user interface elements, however, may involve complex state management issues, which would typically fall to the server-side applications program. The state of a server-side processing module corresponding to the client-side user interface element represents the server-side module""s properties and configuration. A stateless client/server model, however, dictates that in communications between client and server the server does not maintain the state of processes occurring between the client and the server, because the communications connection between the client and server may disappear unexpectedly.
In accordance with the present invention, the above and other problems are solved by providing encapsulated state management for server-side processing of client-side user interface elements in which the server does not maintain the state between requests. The operation of processing the client-side user interface element may include a state management operation, which relates to the state (i.e., the xe2x80x9cviewstatexe2x80x9d) of one or more server-side control objects in a control object hierarchy. A server-side control object processes and generates a client-side user interface element for display on a web page. A hierarchy of server-side control objects may also cooperate to generate the resulting authoring language code, such as standard HTML, for display of a web page on a client. The client can be, for example, any browser that supports standard HTML or another authoring language.
To satisfy the stateless client/server model, state information of server-side control objects may be transported between the client and the server in a transportable state structure, rather than remaining on the server between HTTP requests. When the server receives an HTTP request from the client, the server extracts the state information from a transportable state structure from the HTTP request and distributes the state information to the appropriate individual control objects in the server-side hierarchy. The integrity of the transportable state structure may also be verified using a coded structure associated with the transportable state structure and generated from the state information.
A method for managing a state of a server-side control object corresponding to,a client-side user interface element incorporated in a web page displayed on a client is provided. The server-side control object is created in the control object hierarchy to process the client-side user interface element. A transportable state structure is received from the client. The transportable state structure includes state information indicating a state value for at least one server-side control object in the control object hierarchy. The state information is extracted from the transportable state structure. The state value from the state information is loaded into property of the server-side control object, if the state value is associated with the server-side control object.
A computer program product for managing a state of a plurality of server-side control objects created in a control object hierarchy and corresponding to a plurality of client-side user interface elements incorporated in a web page displayed on a client is provided. A transportable state structure is received from the client includes state information associated with one or more server-side control objects in the control object hierarchy. The state information is serialized to extract a state value, an associated property data type, and hierarchical information for a property of a server-side control object. The server-side control object is located within the control object hierarchy based on the hierarchical information. The state value is loaded into the property of the server-side control object.
An article of manufacture is provided as a computer program product. An embodiment of a computer program product in accordance with the present invention includes a computer program storage medium readable by a computer system and encoding a computer program for executing a computer process managing a state of a server-side control object corresponding to a client-side user interface element incorporated in a web page displayed on a client. An alternative embodiment of a computer program product in accordance with the present invention includes a computer data signal embodied in a carrier wave by a computing system and encoding a computer program managing a state of a server-side control object corresponding to a client-side user interface element incorporated in a web page displayed on a client. A product generated by a process of the present invention is provided as authoring language code, containing a transportable state structure, transmitted to a client and interpreted by a browser on the client.